//
//  StarCollectionViewCell.m
//  Mango
//
//  Created by lanou3g on 16/5/11.
//  Copyright © 2016年 lanou3g. All rights reserved.
//

#import "StarCollectionViewCell.h"

@interface StarCollectionViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *praise;

@end

@implementation StarCollectionViewCell

- (void)setModel:(DiscoverStarsModel *)model {
    if (_model != model) {
        _model = model;
        NSString *iconStr = [model.portrait componentsSeparatedByString:@"?"][0];
        [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:iconStr] placeholderImage:[UIImage imageNamed:@"placeholder"]];
        self.nameLabel.text = model.name;
        self.praise.text = [NSString stringWithFormat:@"%ld赞",model.praise];
    }
}

- (void)awakeFromNib {
    self.iconImageView.layer.cornerRadius = 50;
    self.iconImageView.layer.masksToBounds = YES;
}


#pragma mark 切换至日间模式
-(void)updateToDaySkinMode {
    self.nameLabel.textColor = [UIColor blackColor];
    self.praise.textColor = [UIColor blackColor];
    self.contentView.backgroundColor = [UIColor whiteColor];
}
-(void)updateToNightSkinMode {
    self.nameLabel.textColor = [UIColor grayColor];
    self.praise.textColor = [UIColor grayColor];
    self.contentView.backgroundColor = [UIColor colorWithRed:42/255.0 green:39/255.0 blue:43/255.0 alpha:1.0];
}

@end
